package com.user.controller;

import com.user.domain.dto.TbUserDto;
import com.user.domain.po.TbUser;
import com.user.service.UserLoginService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;


@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserLoginController {

    private final UserLoginService userLoginService;

    @GetMapping("/login")
    public String login(String mobile, String pwd) {
        return userLoginService.login(mobile, pwd);
    }

    @GetMapping
    public TbUser query(Long id) {
        return userLoginService.query(id);
    }

    @PostMapping
    public String post(@RequestBody TbUser tbUser){
        return userLoginService.post(tbUser);
    }
    @PutMapping
    public String UserPut(@RequestBody TbUser tbUser){
        return userLoginService.UserPut(tbUser);
    }
    @DeleteMapping
    public String delete(Long id){
        return userLoginService.delete(id);
    }
}
